-
Notifications
You must be signed in to change notification settings - Fork 411
Sourcery Starbot ⭐ refactored tensorboy/pytorch_Realtime_Multi-Person_Pose_Estimation #158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Due to GitHub API limits, only the first 60 comments can be shown.
model = get_model('vgg19') | ||
model = get_model('vgg19') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 62-124
refactored with the following changes:
- Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index
)
model = get_model('vgg19') | ||
model = get_model('vgg19') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 45-62
refactored with the following changes:
- Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index
)
model = get_model('vgg19') | ||
model = get_model('vgg19') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lines 43-64
refactored with the following changes:
- Replace a[0:x] with a[:x] and a[x:len(a)] with a[x:] (
remove-redundant-slice-index
)
"image_id": 0, | ||
"category_id": 1, | ||
"keypoints": [], | ||
"score": 0 | ||
"score": 0, | ||
"image_id": image_id, | ||
} | ||
one_result["image_id"] = image_id | ||
keypoints = np.zeros((18, 3)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function append_result
refactored with the following changes:
- Merge dictionary assignment with declaration (
merge-dict-assign
)
"image_id": 0, | ||
"category_id": 1, | ||
"keypoints": [], | ||
"score": 0 | ||
"score": 0, | ||
"image_id": image_id, | ||
} | ||
|
||
one_result["image_id"] = image_id | ||
keypoints = np.zeros((17, 3)) | ||
|
||
for part in range(17): | ||
ind = ORDER_COCO[part] | ||
index = int(person_to_joint_assoc[ridxPred, ind]) | ||
|
||
if -1 == index: | ||
if index == -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function append_result_legacy
refactored with the following changes:
- Merge dictionary assignment with declaration (
merge-dict-assign
) - Ensure constant in comparison is on the right (
flip-comparison
)
image = image.astype(np.uint8) | ||
|
||
return image | ||
return image.astype(np.uint8) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function inverse_inception_preprocess
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
if mode not in preprocessors: | ||
return image | ||
return preprocessors[mode](image) | ||
return image if mode not in preprocessors else preprocessors[mode](image) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function preprocess
refactored with the following changes:
- Lift code into else after jump in control flow (
reintroduce-else
) - Replace if statement with if expression (
assign-if-exp
)
range_x = list(range(int(min_x), int(max_x), 1)) | ||
range_y = list(range(int(min_y), int(max_y), 1)) | ||
range_x = list(range(int(min_x), int(max_x))) | ||
range_y = list(range(int(min_y), int(max_y))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function put_vec_maps
refactored with the following changes:
- Replace range(x, y, 1) with range(x, y) [×2] (
remove-unit-step-from-range
)
if -1 == index: | ||
if index == -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function get_result
refactored with the following changes:
- Ensure constant in comparison is on the right (
flip-comparison
)
kp_lines = [ | ||
[keypoints.index('neck'), keypoints.index('right_hip')], | ||
return [ | ||
[keypoints.index('neck'), keypoints.index('right_hip')], | ||
[keypoints.index('right_hip'), keypoints.index('right_knee')], | ||
[keypoints.index('right_knee'), keypoints.index('right_ankle')], | ||
[keypoints.index('neck'), keypoints.index('left_hip')], | ||
[keypoints.index('neck'), keypoints.index('left_hip')], | ||
[keypoints.index('left_hip'), keypoints.index('left_knee')], | ||
[keypoints.index('left_knee'), keypoints.index('left_ankle')], | ||
[keypoints.index('neck'), keypoints.index('right_shoulder')], | ||
[keypoints.index('neck'), keypoints.index('right_shoulder')], | ||
[keypoints.index('right_shoulder'), keypoints.index('right_elbow')], | ||
[keypoints.index('right_elbow'), keypoints.index('right_wrist')], | ||
[keypoints.index('right_shoulder'), keypoints.index('right_eye')], | ||
[keypoints.index('neck'), keypoints.index('left_shoulder')], | ||
[keypoints.index('right_elbow'), keypoints.index('right_wrist')], | ||
[keypoints.index('right_shoulder'), keypoints.index('right_eye')], | ||
[keypoints.index('neck'), keypoints.index('left_shoulder')], | ||
[keypoints.index('left_shoulder'), keypoints.index('left_elbow')], | ||
[keypoints.index('left_elbow'), keypoints.index('left_wrist')], | ||
[keypoints.index('left_shoulder'), keypoints.index('left_eye')], | ||
[keypoints.index('neck'), keypoints.index('nose')], | ||
[keypoints.index('left_shoulder'), keypoints.index('left_eye')], | ||
[keypoints.index('neck'), keypoints.index('nose')], | ||
[keypoints.index('nose'), keypoints.index('right_eye')], | ||
[keypoints.index('nose'), keypoints.index('left_eye')], | ||
[keypoints.index('nose'), keypoints.index('left_eye')], | ||
[keypoints.index('right_eye'), keypoints.index('right_ear')], | ||
[keypoints.index('left_eye'), keypoints.index('left_ear')] | ||
[keypoints.index('left_eye'), keypoints.index('left_ear')], | ||
] | ||
return kp_lines |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function kp_connections
refactored with the following changes:
- Inline variable that is immediately returned (
inline-immediately-returned-variable
)
Thanks for starring sourcery-ai/sourcery ✨ 🌟 ✨
Here's your pull request refactoring your most popular Python repo.
If you want Sourcery to refactor all your Python repos and incoming pull requests install our bot.
Review changes via command line
To manually merge these changes, make sure you're on the
master
branch, then run: